package com.tencreat.service.mall;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tencreat.common.core.HttpResult;
import com.tencreat.common.core.domain.OrderVO;
import com.tencreat.common.core.domain.model.IdAndPage;
import com.tencreat.common.core.domain.model.LoginUser;
import com.tencreat.common.core.domain.model.ReqIdParam;
import com.tencreat.common.core.domain.model.ReqIdsParam;
import com.tencreat.domain.account.MallUser;
import com.tencreat.domain.mall.MallOrderGoods;
import com.tencreat.domain.mall.MallStoreOrder;
import com.tencreat.domain.mall.MallStoreOrderGoods;
import com.tencreat.domain.mall.dto.*;
import com.tencreat.domain.mall.vo.*;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * 店铺订单Service接口
 *
 * @author tencreat
 * @date 2021-08-13
 */
public interface IMallStoreOrderService extends IService<MallStoreOrder> {

    /**
     * 查询订单
     *
     * @param id 订单ID
     * @return 订单
     */
    public MallStoreOrder selectMallOrderById(ReqIdParam id);

    /**
     * 查询订单列表
     *
     * @param mallStoreOrder 订单
     * @return 订单集合
     */
    public List<MallStoreOrder> selectMallOrderList(MallStoreOrder mallStoreOrder);

    /**
     * 新增订单
     *
     * @param mallStoreOrder 订单
     * @return 结果
     */
    public int insertMallOrder(MallStoreOrder mallStoreOrder);

    /**
     * 修改订单
     *
     * @param mallStoreOrder 订单
     * @return 结果
     */
    public int updateMallOrder(MallStoreOrder mallStoreOrder);

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单ID
     * @return 结果
     */
    public int deleteMallOrderByIds(ReqIdsParam ids);

    /**
     * 删除订单信息
     *
     * @param id 订单ID
     * @return 结果
     */
    public int deleteMallOrderById(ReqIdParam id);

    public HttpResult<IPage<ResStoreOrderGoodsVO>> orderList(IdAndPage idParam, LoginUser loginUser);

    public HttpResult<ResOrderGoodsVO> orderInfo(ReqIdParam idParam, LoginUser loginUser);

    HttpResult<ResOrderMallSubmitVO> submit(OrderStoreMallSubmitDTO orderMallSubmitPO, LoginUser loginUser);

    HttpResult<ResOrderMallSubmitVO> submitMember(OrderStoreMallSubmitDTO param, LoginUser loginUser);

    HttpResult<ResStoreOrderMallBudgetVO> budget(StoreOrderMallBudgetDTO orderMallBudgetVO, LoginUser loginUser);

    ResCheckMoneyVO checkMoney(OrderMallSubmitDTO orderMallSubmitPO, LoginUser loginUser);

    //HttpResult<ResOrderMallSubmitVO> submitKill(OrderMallKillSubmitDTO param, LoginUser loginUser);

    public HttpResult<MallOrderStatisticsVO> getInfoNum(MallStoreOrder mallStoreOrder);

    HttpResult<String> selectOrderNum(MallStoreOrder mallStoreOrder) throws ParseException;

    HttpResult<MallStoreOrderVO> selectOrderDetailsById(ReqIdParam reqIdParam);

//    HttpResult<Boolean> ship(MallOrderShipDTO mallOrderShipPO);//发货

    HttpResult<MallOrderStatisticsVO> getInfo(MallStoreOrder mallStoreOrder);

    HttpResult<Boolean> confirmOrder(ReqIdParam idParam, LoginUser loginUser);

    void handleData(MallStoreOrderGoods orderGoods);

    HttpResult<List<MallNewOrderVO>> selectNewOrders(MallStoreOrder mallStoreOrder);

    Page<MallStoreOrder> page(IPage<MallStoreOrder> page, MallStoreOrder mallStoreOrder);

    ResOrderDetailInfoVO getOrderDetail(ReqIdParam id);

    HttpResult<List<Map<String, Object>>> getOrderNumDaily(MallUserAndOrderTimeDTO dto);

    HttpResult<List<Map<String, Object>>> getUserNumDaily(MallUser params);

    HttpResult<Boolean> delAppOrder(ReqIdParam param);

    HttpResult<Boolean> cancelPayOrder(ReqIdParam param);

    HttpResult<Boolean> afterSaleOrder(ReqIdParam param);

    HttpResult<Boolean> cancelOrder(OrderVO orderVO);

    OrderStatisticsVO supplierOrderStatistics(Long userId);

    HttpResult<List<Map<String, Object>>> getOrderIncomeDaily(MallStoreOrder params);

    MallStoreOrder getOrderByOrderSn(String orderSn);

    AdminIndexStaticsVO indexStatistics();

    /**
     * 订单管理数据统计
     *
     * @return
     */
    MallAdminOrderStatisticsVO orderStatistics(Long userId, Integer orderMold);

    /**
     * 会员订单金额统计
     *
     * @return
     */
    MallAdminMemberStatisticsVO memberStatistics();

    HttpResult<ResOrderCountVO> orderCount(LoginUser loginUser);

    Integer buyers(Long goodsId);
}
